package com.prueba.client.configuracion;

import com.prueba.client.configuracion.TablaPreferencias;
import com.prueba.client.configuracion.TablaRequerimientos;
import com.prueba.client.configuracion.TablaStakeholders;
import com.prueba.client.configuracion.TablaVistasYCostos;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;

public class ConfigurationWindow extends Window{
	static public ConfigurationWindow getInstance(){
		if (singleton==null){
			singleton=new ConfigurationWindow();
		}
		return singleton;
	}
	static private ConfigurationWindow singleton=null;
	
	private ConfigurationWindow(){
		this.maximize();
        //tabs de parametros:
        TabSet topTabSet = new TabSet();     
        topTabSet.setPadding(5);
        
        
        Tab tabStakeholders = new Tab("Stakeholders", "stakeholder.png");  
        tabStakeholders.setPane(TablaStakeholders.getInstance());  
        
        Tab tabRequerimientos = new Tab("Requerimientos", "requerimiento.png");    
        tabRequerimientos.setPane(TablaRequerimientos.getInstance());  
        
        Tab tabPreferencias = new Tab("Preferencias", "preferencia.png");   
        tabPreferencias.setPane(TablaPreferencias.getInstance()); 
        
        Tab tabVistasYCostos = new Tab("Vistas y costos", "vista.png");    
        tabVistasYCostos.setPane(TablaVistasYCostos.getInstance());         
        
        
        topTabSet.addTab(tabStakeholders);  
        topTabSet.addTab(tabRequerimientos);  
        topTabSet.addTab(tabPreferencias);  
        topTabSet.addTab(tabVistasYCostos);    
        topTabSet.setAlign(Alignment.CENTER);
        
        
        //Botones inferiores:
        HLayout buttons = new HLayout();  
        buttons.setMembersMargin(15);  
  
        IButton restablecerButton = new IButton("Reestablecer configuracion");  
        restablecerButton.addClickHandler(new ClickHandler() {  
            public void onClick(ClickEvent event) {  
                //reestablecer configuracion:
            }  
        });  
  
        IButton aplicarButton = new IButton("Aplicar cambios");  
        aplicarButton.addClickHandler(new ClickHandler() {  
            public void onClick(ClickEvent event) {  
                //aplicar cambios:
            }  
        });  
        
        IButton cancelarButton = new IButton("Cancelar");  
        aplicarButton.addClickHandler(new ClickHandler() {  
            public void onClick(ClickEvent event) {  
                //aplicar cambios:
            }  
        }); 
        
        buttons.addMember(restablecerButton);  
        buttons.addMember(aplicarButton);  
        buttons.addMember(cancelarButton);
        
        VLayout mainLayout = new VLayout();  
        mainLayout.setMembersMargin(15);  
        mainLayout.addMember(topTabSet); 
       
        
        
        mainLayout.addMember(buttons); 
        buttons.setAlign(Alignment.CENTER);
        mainLayout.setAlign(VerticalAlignment.CENTER);
        //mainLayout.setHeight("auto");  
        
        topTabSet.setWidth(500);
        topTabSet.setHeight(500);
  

        //parametros de la ventana:  
        this.setTitle("Configuracion de parametros");  
        
       
        //this.setWidth100();  
        //this.setHeight100();
        this.setCanDragReposition(true);  
        this.setCanDragResize(true);  
        
        /*
        window.setAutoSize(autoSizing);  
        window.setTitle(title);  
        window.setWidth(width);  
        window.setHeight(height);  
        window.setLeft(offsetLeft);  
        window.setCanDragReposition(true);  
        window.setCanDragResize(true);  */
        this.addItem(mainLayout);
       
        

        
	}
}